﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="scheduling.aspx.cs" Inherits="pages_admin_scheduling" MasterPageFile="~/template/template.master" EnableViewState="true"%>

<%@ Register Namespace="UTS.Controls" TagPrefix="uts" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<%@ Register TagPrefix="uts" TagName="message" Src="~/controls/DisplayMessage.ascx" %>

<asp:Content ContentPlaceHolderID="MainContent" ID="GenerationContent" runat="server">

<asp:UpdatePanel ID="SchedulesDisplayPanel" runat="server" UpdateMode="Always">
    <ContentTemplate>
        <asp:Panel ID="ScheduleViewingPanel" runat="server">
            <uts:message ID="Message" runat="server" />
            
            
            <uts:SemesterDropDownList ID="SemesterListDropDown" runat="server" DataTextField="SemesterName" DataValueField="SemesterId" OnSelectedIndexChanged="SemesterDropDownControl_SelectedIndexChanged" AutoPostBack="true"/>
            <uts:CohortDropDownList ID="CohortDropDownList" runat="server" DataTextField="CohortName" DataValueField="CohortId" OnSelectedIndexChanged="CohortDropDownControl_SelectedIndexChanged" AutoPostBack="true" />
            <uts:ModuleDropDownList ID="ModuleDropDownList" runat="server" DataTextField="ModuleName" DataValueField="ModuleId" OnSelectedIndexChanged="ModuleDropDownControl_SelectedIndexChanged" AutoPostBack="true" />
            
            <asp:Button ID="PrintCalendar" runat="server" OnClick="PrintSchedule" Text="Print"/>
            <DayPilot:DayPilotCalendar ID="EventCalendar" runat="server" TimeFormat="Clock24Hours" HeaderDateFormat="dddd" EventClickHandling="PostBack" OnEventClick="Schedule_EventClicked" FreetimeClickHandling="PostBack" OnFreeTimeClick="FreeTime_Clicked"/>
        </asp:Panel>
        
        <asp:Panel ID="ScheduleEditingPanel" runat="server" Visible="false">
            <asp:DetailsView ID="TimetableEventScheduleView" runat="server" CssClass="detailstable" FieldHeaderStyle-CssClass="bold" AutoGenerateRows="false" DefaultMode="Edit" OnDataBound="TimetableEventScheduleView_DataBound" OnItemCommand="TimetableEventScheduleView_ItemCommand">
                <Fields>
                    <asp:TemplateField Visible="true" HeaderText="Semester">
                        <EditItemTemplate>
                            <asp:Literal ID="Semester" runat="server" />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <uts:SemesterDropDownList ID="SemesterDropDownControl" runat="server" DataTextField="SemesterName" DataValueField="SemesterId" OnSelectedIndexChanged="SemesterDropDownControl_SelectedIndexChanged" AutoPostBack="true"/>
                        </InsertItemTemplate>
                    </asp:TemplateField>                                    
                    <asp:TemplateField Visible="true" HeaderText="Cohort">
                        <EditItemTemplate>
                            <asp:Literal ID="Cohort" runat="server" />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <uts:CohortDropDownList ID="CohortDropDownControl" runat="server" DataTextField="CohortName" DataValueField="CohortId" OnSelectedIndexChanged="CohortDropDownControl_SelectedIndexChanged" AutoPostBack="true"/>
                        </InsertItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField Visible="true" HeaderText="Module">
                        <EditItemTemplate>
                            <asp:Literal ID="Module" runat="server" />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <uts:ModuleDropDownList ID="ModuleDropDownControl" runat="server" DataTextField="ModuleName" DataValueField="ModuleId" OnSelectedIndexChanged="ModuleDropDownControl_SelectedIndexChanged" AutoPostBack="true"/>
                        </InsertItemTemplate>
                    </asp:TemplateField>                    
                    <asp:TemplateField Visible="true" HeaderText="ModuleEvent">
                        <EditItemTemplate>
                            <asp:Literal ID="ModuleEvent" runat="server" />
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <uts:ModuleEventDropDownList ID="ModuleEventDropDownControl" runat="server" DataTextField="ModuleEventLabel" DataValueField="ModuleEventId"/>
                        </InsertItemTemplate>
                    </asp:TemplateField>                                        
                    <asp:TemplateField Visible="true" HeaderText="Room">
                        <EditItemTemplate>
                            <uts:RoomDropDownList ID="Room" runat="server" DataTextField="RoomName" DataValueField="RoomId"/>
                        </EditItemTemplate>
                    </asp:TemplateField>                    
                    <asp:TemplateField Visible="true" HeaderText="CourseDay">
                        <EditItemTemplate>
                            <uts:CourseDayDropDownList ID="CourseDay" runat="server" DataTextField="CourseDayName" DataValueField="CourseDayId"/>
                        </EditItemTemplate>
                    </asp:TemplateField>                                        
                    <asp:TemplateField Visible="true" HeaderText="StartTime">
                        <EditItemTemplate>
                            <uts:TimeInputControl Id="StartTime" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>                                                         
                    <asp:TemplateField Visible="true" HeaderText="EndTime">
                        <EditItemTemplate>
                            <uts:TimeInputControl Id="EndTime" runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>                                     
                                  
                </Fields>
                
                <FooterTemplate>
                    <asp:Button ID="Back" runat="server" OnClick="BackButton_Clicked" Text="Back"/>
                    <asp:Button ID="Update" runat="server" CommandName="Update" Text="Update"/>
                    <asp:Button ID="Delete" runat="server" CommandName="Delete" Text="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");'/>
                </FooterTemplate>
            </asp:DetailsView>
        
        </asp:Panel>
        
    </ContentTemplate>
</asp:UpdatePanel>


</asp:Content>